package com.zhouxiaoge.cxf.service;

import org.apache.cxf.ext.logging.LoggingInInterceptor;
import org.apache.cxf.ext.logging.LoggingOutInterceptor;
import org.apache.cxf.frontend.ServerFactoryBean;

public class CXServer {

    public static void main(String[] args) {
        String address = "http://127.0.0.1:8888/hello";
        ServerFactoryBean bean = new ServerFactoryBean();
        bean.setAddress(address);
        bean.setServiceBean(new CXServer());
        bean.getInInterceptors().add(new LoggingInInterceptor());
        bean.getOutInterceptors().add(new LoggingOutInterceptor());
        bean.create();
        System.out.println("WSDL地址: " + address + "?wsdl");
    }

    public String sayHello(String name) {
        return name + ", 你好！This is ServerFactoryBean！";
    }
}
